package com.windupurnomo;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class Home extends Activity implements OnClickListener{
	Button btnPlay, btnOptions, btnBestPlayer, btnHelp, btnExit;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        btnPlay = (Button) findViewById(R.id.btnPlayGame);
        btnOptions = (Button) findViewById(R.id.btnOptions);
        btnBestPlayer = (Button) findViewById(R.id.btnBestPlayer);
        btnHelp = (Button) findViewById(R.id.btnHelp);
        btnExit = (Button) findViewById(R.id.btnExit);
        
        btnPlay.setOnClickListener(this);
        btnOptions.setOnClickListener(this);
        btnBestPlayer.setOnClickListener(this);
        btnHelp.setOnClickListener(this);
        btnExit.setOnClickListener(this);
    }
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.game_menu, menu);
	    return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem menuItem){
		switch(menuItem.getItemId()){
			case R.id.playGame: Toast.makeText(this, "Kamu memilih New Game", Toast.LENGTH_LONG).show(); break;
			case R.id.options: Toast.makeText(this, "Kamu memilih New Game", Toast.LENGTH_LONG).show(); break;
			case R.id.bestPlayer: Toast.makeText(this, "Kamu memilih New Game", Toast.LENGTH_LONG).show(); break;
			case R.id.help: Toast.makeText(this, "Kamu memilih New Game", Toast.LENGTH_LONG).show(); break;
			case R.id.quit: Toast.makeText(this, "Kamu memilih Quit", Toast.LENGTH_LONG).show(); break;
		}
		return true;
	}

	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.btnPlayGame:{
				Intent i = new Intent(this, PlayerProfile.class);
				startActivity(i);
				break;
			}
			case R.id.btnOptions:{
				Intent i = new Intent(this, Options.class);
				startActivity(i);
				break;
			}
			case R.id.btnBestPlayer:{
				Intent i = new Intent(this, BestPlayer.class);
				startActivity(i);
				break;
			}
			case R.id.btnHelp:{
				Intent i = new Intent(this, Options.class);
				startActivity(i);
				break;
			}
			case R.id.btnExit:{
				this.finish();
				break;
			}
		}
		
	}
}
